package com.song.flowable.view.po;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 流程模型
 */
@Data
@Accessors(chain = true)
public class ModelRequest {
    @ApiModelProperty("模型ID")
    private String id;

    @ApiModelProperty("模型KEY")
    private String key;

    @ApiModelProperty("模型名称")
    private String name;

    @ApiModelProperty("模型标识")
    private String category;

    @ApiModelProperty("模型描述")
    private String description;

    @ApiModelProperty("TENANT_ID")
    private String tenantId;

    @ApiModelProperty("流程富文本")
    private String editor;

    @ApiModelProperty("模型状态")
    private String modelState;

    @ApiModelProperty("提醒回调路径")
    private String warningRequestUrl;

    @ApiModelProperty("结束回调路径")
    private String endUrl;

    @ApiModelProperty("NEW_VERSION")
    private boolean newVersion;

    @ApiModelProperty("CASCADE")
    private boolean cascade;

    @ApiModelProperty("MODEL_CATEGORYS")
    private String modelCategorys;

    public String getMetaInfo() {
        ObjectMapper objectMapper = new ObjectMapper();
        ObjectNode metaInfo = objectMapper.createObjectNode();
        metaInfo.put("name", name);
        metaInfo.put("description", description);
        metaInfo.put("modelState", modelState);
        metaInfo.put("warningRequestUrl", warningRequestUrl);
        metaInfo.put("endUrl", endUrl);
        return metaInfo.toString();
    }
}
